{% from 'lib/picture.html' import picture %}
{% extends 'lib/layout.html' %}
{% block body %}

<section>
{% include "lib/greet.html" %}
    <p>Forget is a service that automatically deletes your old posts. Shouldn't databases forget too?</p>
</section>

{% if not g.viewer %}
<section>
<h2 id="sign_in">Sign in</h2>
{% if twitter_login_error %}
<div class="banner error">
    Sorry, something went wrong when logging you in with Twitter. Give it another shot, maybe?
</div>
{% endif %}

<p>
<a class='btn primary twitter-colored' href="/login/twitter">
    {{picture(st, 'twitter', (20,40,80), ('webp', 'png'))}}
    Log in with Twitter
</a>
</p>

<p id='mastodon_instance_buttons'>

{% for instance in mastodon_instances %}
<a class='btn primary mastodon-colored' href="{{ url_for('mastodon_login_step1', instance_url=instance) }}">
{% if loop.first %}
    {{picture(st, 'mastodon', (20,40,80), ('webp', 'png'))}}
    Log in with
{% endif %}
        {{instance}}
</a>
{% else %}
<a class='btn primary mastodon-colored' href="{{ url_for('mastodon_login_step1') }}">
    {{picture(st, 'mastodon', (20,40,80), ('webp', 'png'))}}
    Log in with Mastodon
</a>
{% endfor %}

{% if mastodon_instances %}
<a class='btn secondary' href="{{ url_for('mastodon_login_step1') }}">
    Another Mastodon instance
</a>
{% endif %}

</p>
</section>


<script type="application/json" id="top_instances">
[
{% for instance in mastodon_instances %}
    {"instance": "{{instance}}"}
    {%- if not loop.last -%}
    ,
    {%- endif %}
{% endfor %}
]
</script>

<script type="text/html+template" id="instance_button_template">
    <a class='btn primary mastodon-colored'
        href="{{ url_for('mastodon_login_step1') }}?instance_url=${encodeURIComponent(instance)}">
        ${ !first? '' : `
            {{picture(st, 'mastodon', (20,40,80), ('webp', 'png'))}}
            Log in with
            `}
        ${ instance }
    </a>
</script>

<script type="text/html+template" id="another_instance_button_template">
    <a class='btn secondary' href="{{ url_for('mastodon_login_step1') }}">
        Another Mastodon instance
    </a>
</script>


{% endif %}

<section>
<h2>Features</h2>
<ul>
    <li>Delete your posts when they cross an age threshold.</li>
    <li>Or keep your post count in check, deleting old posts when you go over.</li>
    <li>Preserve old posts that matter by giving them a favourite.</li>
    <li>Set it and <i>forget</i> it. Forget works continuously in the background.</li>
</ul>
</section>

<section>
<h2>Non-features</h2>
<p>
    Forget is not a one-time purging tool.
    It is designed to prune your account continuously, not quickly.
    If you need a lot of posts gone fast, you may want to look for another more-suited tool.
</p>
</section>

{% endblock %}


{% block scripts %}
<script defer src="{{st('instance_buttons.js')}}"></script>
{% endblock %}
